function calculatePrice() {
  // 想办法调用`bestCharge`并且把返回的字符串
  // 显示在html页面的`message`中
  let selectedItems = [];
  selectedItems.push({
    id: 'ITEM0001',
    num: document.getElementById('ITEM0001').value,
    name:'黄焖鸡'
  })
  selectedItems.push({
    id: 'ITEM0013',
    num: document.getElementById('ITEM0013').value,
    name:'肉夹馍'
  })
  selectedItems.push({
    id: 'ITEM0022',
    num: document.getElementById('ITEM0022').value,
    name:'凉皮'
  })
  selectedItems.push({
    id: 'ITEM0030',
    num: document.getElementById('ITEM0030').value,
    name:'冰峰'
  })

  length = selectedItems.length
  for(let i = 0;i<length;i++){
    if(selectedItems[i].num == 0){
      selectedItems.splice(i,1);
      length = length -1;
    }
  }

  var price = bestCharge(selectedItems);

  var result = '============= 订餐明细 ============='+'\n';
  for (let i = 0; i < selectedItems.length; i++) {
    if (selectedItems[i].num > 0)
    result +=  selectedItems[i].name + ' x ' + selectedItems[i].num + '\n';
}
  result = result + 
  '-----------------------------------'+'\n'+
  '使用优惠:'+'\n'
  if(price[0] == 1 ){
    result = result + '满30减6元，省6元'+'\n'
  }else if(price[0] == 2){
    result = result +   '指定菜品半价 (黄焖鸡，凉皮)'+'\n'
  }
  result = result + 
  ' -----------------------------------'+'\n'+
  ' 总计：'+ price[1]+ '元'+'\n'+
  '==================================='


  document.getElementById('message').innerHTML = result
}

function clearAll() {
  
  // 清除用户的选择，以及页面显示的信息
  // 清除之后，用户可以继续正常使用各项功能
  location.reload();
  
}

window.onload = function() {
  
  let items = loadAllItems();
  let itemsHtml = '';
  for (let i = 0; i < items.length; i++) {
      itemsHtml += '<div class="menuStsyle"><span value=' + items[i].id + '>' + items[i].name + " " +
      items[i].price + '元:&nbsp;&nbsp</span>' + '<input class="input"id=' + items[i].id + ' type="text">' + "&nbsp;&nbsp;&nbsp;&nbsp;" + '</div>';
  }

  //加载优惠方式
  let promotions = loadPromotions();
  let promotionsHtml = '';
  promotionsHtml = '有两种优惠方式:\n'
  promotionsHtml += '<p>第一种方式是：' + promotions[0].type + '</p>';
  promotionsHtml += '<p>第二种方式是：' + promotions[1].type + " (" + items[0].name + "，" + items[2].name + ')</p>';
  document.getElementById('promotions').innerHTML = promotionsHtml
}